package rrs;

/**
 * <oracle install path>\product\10.2.0\db_1\jdbc\lib\jdbc\ojdbc14.jar
 * adds reference to JDBC library
 */
import java.sql.*; 

public class DBInterface 
{
   static Connection conn;
   
   public static Connection dbConnOpen()
   {
        try 
        {
            Class.forName ("oracle.jdbc.driver.OracleDriver");
            String user;
            String pass; 
    
            //user ID for database connection
            user = "rstachu";
            //password for database connection
            pass = "rstachu";
        
            conn = DriverManager.getConnection
                     ("jdbc:oracle:thin:"+user+"/"+pass+"@oracle.cs.luc.edu:1521:orcl");
        } 
        catch (Exception e) 
        {
            System.out.println ("Could not load the driver"); 
        }
        return conn;
    }
    public static Connection dbConnClose() 
    {
        try 
        {
            Class.forName ("oracle.jdbc.driver.OracleDriver");
        } 
        catch (ClassNotFoundException e) 
        {
            System.out.println ("Could not close the connection"); 
        }
        try
        {
            conn.close();
        }
        catch (Exception e)
        {
            System.out.println("Error");
        }
        return conn;
    }
}
